package com.cskaoyan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 请求头限定
 * @author stone
 * @date 2022/06/21 11:24
 */
@Controller
@RequestMapping("header")
public class HeaderLimitController {


    @RequestMapping(value = "limit", headers = {"abc", "def"})//既要携带abc、又要携带def这两个请求头
    @ResponseBody
    public String headerLimit() {
        return "header limit";
    }

    /**
     * ContentType请求头的值的限定  xxx/xxx
     */
    @RequestMapping(value = "consumes",consumes = "abc/def")
    @ResponseBody
    public String consumes() {
        return "Content-Type limit";
    }


    /**
     * Accept请求头的值的限定  xxx/xxx
     */
    @RequestMapping(value = "produces",produces = "def/abc")
    @ResponseBody
    public String produces() {
        return "Accept limit";
    }
}
